import { createRouter, createWebHistory } from 'vue-router';

import ListView from '../views/ListView.vue';

const router = createRouter({
    history: createWebHistory(), // 是个方法
    routes: [
        {
            path: '/',
            component: ListView
        },
        {
            path: '/List',
            component: ListView
        },
        {
            path: '/User',
            props: (route) => ({ id: route.query.id }), // 将query参数传递给User组件
            component: () => import('../views/UserView.vue')
        }
    ]
})

export default router